I tried GitHub Copilot for CloudFormation Templates

I tried GitHub Copilot for CloudFormation Templates

Clock Icon2021.12.17

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Before we start, check out my previous blog on GitHub Copilot

Working on my first project made me realise how hard and time-consuming it is to search for parameters for the CloudFormation template on documentation and other sources.

And I am sure that even after years of working on multiple projects, there will always be something new for which one needs to do a lot of research and exploration in order to get the correct term. Well, not anymore, we have Copilot to help us by eliminating the need to search on platforms such as Stack Overflow, GitHub Repositories, and so on.

I tried GitHub Copilot for Infrastructure as Code(IaC), and it did what it's supposed to do, it eliminated half of my work in just a snap.

Copilot for Infrastructure as Code(IaC)

GitHub Copilot is designed for folks who work with JSON templates. Sorry, YAML folks; Copilot will not be able to accompany you on this voyage; maybe, YAML support might be added soon, but you are on your own right now.

So how is working with Copilot? Let's begin with a quick demonstration of Copilot suggesting the complete parameter block using just one phrase.

Yes, this is the strength of Copilot; it can not only recommend a block of code, but it can also suggest many variations of the same block, which we shall look at momentarily.

Multiple Versions of a Block

Copilot not only proposes a block of code but also numerous variants of it; the more it learns, the more it suggests, so we don't have to rely on just one proposal; instead, we may choose from multiple blocks based on our preferences.

With just a click of a button, you can change the suggested block of code and select among various different implementations, it's always good to have multiple options as it gives us flexibility and the privilege to select.

Auto Complete

GitHub Copilot can not only recommend a block of code, but it can also work as an auto-complete of a line of code, which is very useful when modifying a block of code that Copilot suggested or in any other case when we may want assistance.

When Copilot is unable to propose a block of code, the AutoComplete function comes in handy. Copilot makes it much easier to code, especially the individual lines of code.

It not always correct

There are many services for which it still cannot recommend the code, or it offers something completely different from what we want it to, the reason being that it is not trained sufficiently for this work, which will undoubtedly improve as its popularity grows.

But there is one thing we should all remember: "A genius in the wrong position may appear like a fool," and Copilot can make you look exactly like that if you don't pay attention.

Conclusion

It's a tool to make our lives easier, but if not used correctly, it may do the opposite. It's still far from good enough to rely on totally, and I believe it never will be, since if it does get good enough, what is the need for us?

Copilot has absolutely made my life better and will continue to do so, maybe even better, since it is presently under technical preview, you have to sign up and wait for your opportunity to get your hands on it, which you can do here.

Disclaimer: Use under professional supervision, and don't try it everywhere.

Reference

  1. https://copilot.github.com/
  2. https://github.com/github/copilot-docs/blob/main/docs/visualstudiocode/gettingstarted.md
  3. https://dev.classmethod.jp/articles/github-copilot/
  4. https://dev.classmethod.jp/articles/fly-with-github-copilot/#toc-2

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.